/**
 * Created by tdzl2003 on 6/26/16.
 */

import React, { PropTypes } from 'react';

import {
  TouchableOpacity,
  Text,
  StyleSheet,
} from 'react-native';


const styles = StyleSheet.create({
  button: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    alignSelf: 'stretch',
  },
  label: {
    fontSize: 16,
  },
  confirm: {
    color: 'rgb(241,166,51)',
  },
  disabled: {
    color: '#666666',
  },
});

const propTypes = {
  ...TouchableOpacity.propTypes,

  label: PropTypes.string.isRequired,
  type: PropTypes.string,
  disabled: PropTypes.bool,
};

export default function DialogButton(props) {
  const { label, type, disabled, ...others } = props;
  return (
    <TouchableOpacity style={styles.button} disabled={disabled} {...others}>
      <Text style={[styles.label, type && styles[type], disabled && styles.disabled]}>
        {label}
      </Text>
    </TouchableOpacity>
  );
}

DialogButton.propTypes = propTypes;
